#ifndef MyDateDelegate_H
#define MyDateDelegate_H

#include <QStyledItemDelegate>
#include <QDateEdit>
#include <QDebug>

class MyDateDelegate : public QStyledItemDelegate
{
    Q_OBJECT

public:
    explicit MyDateDelegate(QObject *parent = nullptr);

    // 创建编辑器（如 QDateEdit）
    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;

    // 从模型中读取数据并设置到编辑器中
    void setEditorData(QWidget *editor, const QModelIndex &index) const override;

    // 将编辑器中的数据写回模型
    void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;

    // 自定义绘制显示
    void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;

    // 验证输入数据并更新编辑器
    void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
};

#endif // MyDateDelegate_H
#ifndef MYMyDateDelegate_H
#define MYMyDateDelegate_H

#include <QObject>

class MyMyDateDelegate : public QObject
{
    Q_OBJECT
public:
    explicit MyMyDateDelegate(QObject *parent = nullptr);

signals:

};

#endif // MYMyDateDelegate_H
